package com.trkj.service;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.trkj.dao.CarSelectDao;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.trkj.dao.ParkingDao;
import com.trkj.entity.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;


import java.util.List;

@Service
@Slf4j
public class ParkingServiceImpl implements ParkingService{
    @Autowired
    private ParkingDao parkingDao;




    @Override
    @Cacheable(cacheNames = "allusers",key = "#currentPage+','+#pageSize")
    public PageInfo<ParkingEntity> selectAll(ParkingEntity parkingEntity, int currentPage, int pageSize) {
        PageHelper.startPage(currentPage, pageSize);
        List<ParkingEntity> List = this.parkingDao.selectAll(parkingEntity);
        PageInfo<ParkingEntity> pageDto = new PageInfo<>(List);
        log.debug("123:{}", pageDto);
        return pageDto;
    }



    @Override
    public List<ZongEntity> HousfindAll() {
        List<ZongEntity> list=parkingDao.HousfindAll();
        return list;
    }

    @Override
    public int addCarspaces(CarspacesEntity carspacesEntity){
        int count=parkingDao.addCarspaces(carspacesEntity);
        return count;
    }

    @Override
    public int selectMaxid() {
        int max=parkingDao.selectMaxid();
        return max;
    }

    @Override
    public int addCarParkingHousemanageYard(CarParkingHousemanageYardEntity carParkingHousemanageYardEntity){
        int count=parkingDao.addCarParkingHousemanageYard(carParkingHousemanageYardEntity);
        return count;
    }


}
